<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增消息中心')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-msg-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">编码：</label>
                <div class="col-sm-8">
                    <input id="id_pubfld" class="form-control" type="text" >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input id="na_pubfld" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">长度：</label>
                <div class="col-sm-8">
                    <input id="num_lth" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">精度：</label>
                <div class="col-sm-8">
                    <input id="num_prec" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">类型：</label>
                <div class="col-sm-8">
                    <select id="mainSelectId" class="form-control m-b">
                        <option value="12">VARCHAR</option>
                        <option value="-9">NVARCHAR</option>
                        <option value="2">NUMERIC</option>
                        <option value="3">DECIMAL</option>
                        <option value="4">INTEGER</option>
                        <option value="-5">BIGINT</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "md/med/dim"
        $("#form-msg-add").validate({
            focusCleanup: true
        });

        function submitHandler() {

            var naPubfld = $("#na_pubfld").val();
            var idPubfld = $("#id_pubfld").val();
            var numLth = $("#num_lth").val();
            var numPrec = $("#num_prec").val();
            var euJavatp = $("#mainSelectId").val();
            var naJavatp = $("#mainSelectId option:checked").text();
            var tableName=[[${tableName}]];
            if(euJavatp=="") {
                layer.alert("请选择字段类型");
                return;
            }
            var data = {"tableName":tableName,"mdMedTbFld":{"mdMedTbFld":naPubfld,"idPubfld":idPubfld,"naPubfld":naPubfld,"numLth":numLth,"numPrec":numPrec,"euJavatp":euJavatp,"naJavatp":naJavatp}};
            $.ajax({
                url: prefix+'/saveDimFld',
                type: 'post',
                dataType: 'json',
                contentType: 'application/json;charset=UTF-8',
                data: JSON.stringify(data),
                success: function (result) {
                    if(result.code==0) {
                        $.modal.close();
                    }
                }
            });
        }
    </script>
</body>
</html>